package string;

public class Test {
    public static void main(String[] args) {
        String s=new String("hello");
        String s1 ="hello";
        System.out.println(s==s1);
        System.out.println(s.equals(s1));


        String str="我爱Java!";
        int len = str.length();
        System.out.println(len);

        String str1="   hello world   ";
        str1=str1.trim();
        System.out.println(str1);

        String str2 ="我爱Java!";
        String upper=str2.toUpperCase();
        System.out.println(upper);
        String lower=str2.toLowerCase();
        System.out.println(lower);




        String str3="thinking in java";
        boolean starts=str3.startsWith("think");
        System.out.println(starts);
        boolean ends= str3.endsWith(".png");
        System.out.println(ends);


        String str4="thinking in java";
        char c=str4.charAt(8);
        System.out.println(c);



        String str5="thinking in java";
        int index=str5.indexOf("in");
        System.out.println(index);
        index=str5.indexOf("in",3);
        System.out.println(index);
        index=str5.indexOf("abc");
        System.out.println(index);
        index=str5.lastIndexOf("in");
        System.out.println(index);


        String str6="www.tedu.cn";
        int start=str6.indexOf(".")+1;
        int end=str6.indexOf(".",start);
        String name=str6.substring(start,end);
        System.out.println(name);


        int a=123;
        String a1=String.valueOf(a);
        System.out.println(a1);
        double b=123.456;
        String b2=String.valueOf(b);
        System.out.println(b2);

        String b3=b+"";
        System.out.println(b3);



        String aaa="好好学习java";
        StringBuilder builder=new StringBuilder(aaa);

        builder.append(",为了找个好工作");
        System.out.println(builder);

        builder.replace(9,16,"就是为了改变世界");
        System.out.println(builder);

        builder.delete(0,8);
        System.out.println(builder);

        builder.insert(0,"或者");
        System.out.println(builder);







    }
}
